From: cl349@firebug.cl.cam.ac.uk Date: Tue, 13 Sep 2005 21:24:03 +0000 (+0000) Subject: Don't cause watch fire deadlock by unconditionally rewriting the sysrq node. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~16806^2~26 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=5333aa48f3f8799e9d5233fd2603b6be7a046b7b;p=xen.git Don't cause watch fire deadlock by unconditionally rewriting the sysrq node. Signed-off-by: Christian Limpach --- diff --git a/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c b/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c index 2358970468..b6608cef49 100644 --- a/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c +++ b/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c @@ -355,16 +355,26 @@ static void shutdown_handler(struct xenbus_watch *watch, const char *node) static void sysrq_handler(struct xenbus_watch *watch, const char *node) { char sysrq_key = '\0'; - + int err; + + again: + err = xenbus_transaction_start("control"); + if (err) + return; if (!xenbus_scanf("control", "sysrq", "%c", &sysrq_key)) { printk(KERN_ERR "Unable to read sysrq code in control/sysrq\n"); - return; + xenbus_transaction_end(1); + return; } - xenbus_printf("control", "sysrq", "%c", '\0'); + if (sysrq_key != '\0') + xenbus_printf("control", "sysrq", "%c", '\0'); - if (sysrq_key != '\0') { + err = xenbus_transaction_end(0); + if (err == -ETIMEDOUT) + goto again; + if (sysrq_key != '\0') { #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) handle_sysrq(sysrq_key, NULL, NULL); #else